package Chapter2.Comparing.c8;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileReaderDemo {
    public static void main(String[] args) {
        try{
            FileReader fr = new FileReader("Doc/b.txt");

            char[] characters = new char[100000];
            int len;
            int key=2851;
            len = fr.read(characters);
            fr.close();
            FileWriter fw = new FileWriter("Doc/b.txt");
            for (int i=0;i<len;i++) {
                fw.write(characters[i]^key);
            }
            fw.close();

        }
        catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }
}
